package cn.iocoder.idata.module.idata.dal.mysql.dataset;

import java.util.*;

import cn.iocoder.idata.framework.common.pojo.PageResult;
import cn.iocoder.idata.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.idata.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.idata.module.idata.dal.dataobject.dataset.DataSetDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.idata.module.idata.controller.admin.dataset.vo.*;

/**
 * 数据集 Mapper
 *
 * @author 智数源码
 */
@Mapper
public interface DataSetMapper extends BaseMapperX<DataSetDO> {

    default PageResult<DataSetDO> selectPage(DataSetPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DataSetDO>()
                .likeIfPresent(DataSetDO::getDataSetName, reqVO.getDataSetName())
                .eqIfPresent(DataSetDO::getDataSetSort, reqVO.getDataSetSort())
                .eqIfPresent(DataSetDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(DataSetDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(DataSetDO::getId));
    }

    default List<DataSetDO> selectList(DataSetExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<DataSetDO>()
                .likeIfPresent(DataSetDO::getDataSetName, reqVO.getDataSetName())
                .eqIfPresent(DataSetDO::getDataSetSort, reqVO.getDataSetSort())
                .eqIfPresent(DataSetDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(DataSetDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(DataSetDO::getId));
    }

}
